/* tslint:disable:no-console */
import React from 'react';
import {ScrollView, Text, View} from 'react-native';
import {
    InputItem,
    Button,
    Modal,
    WhiteSpace,
    WingBlank,
    Toast,
    Provider,
    PickerView,
} from '@ant-design/react-native';

const seasons = [
    [
        {
            label: '选择方式',
            value: '选择方式',
        },
        {
            label: '出租',
            value: '出租',
        },
        {
            label: '出售',
            value: '出售',
        },
    ],
];
export default class BasicModalExample extends React.Component {
    constructor(props) {
        super(props);

        this.onClose2 = () => {
            this.setState({
                visible: false,
            });
        };

        this.state = {
            value: undefined,
            visible: false,
        };

        this.onChange = (value) => {
            this.setState({
                value,
            });
        };
    }
    render() {
        const footerButtons = [
            {text: 'Cancel', onPress: () => console.log('cancel')},
            {text: 'Ok', onPress: () => console.log('ok')},
        ];
        return (
            <>
                <ScrollView style={{marginTop: 200}}>
                    <WingBlank>
                        <Button onPress={() => this.setState({visible: true})}>
                            popup
                        </Button>
                        <WhiteSpace />
                    </WingBlank>

                    <Modal
                        popup
                        visible={this.state.visible}
                        animationType="slide-up"
                        onClose={this.onClose2}>
                        <View
                            style={{
                                paddingVertical: 20,
                                paddingHorizontal: 20,
                            }}>
                            <PickerView
                                onChange={this.onChange}
                                value={this.state.value}
                                data={seasons}
                                cascade={false}
                            />
                        </View>
                        <Button type="primary" onPress={this.onClose2}>
                            close modal
                        </Button>
                    </Modal>
                </ScrollView>
            </>
        );
    }
}
